<%--
 *  File:    MasterdataRelationship.jsp
 *  @Author: banshang
 *  Date:    2010/07/17
 *
 *  Copyright (C) 2000 - 2002 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.*" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>


<% //--------------------------------------  setting logger --%>


<% //--------------------------------------  variant and initialization --%>
<%
	String strModuleName = "DMS";
 	String strTableName = "v_relationship";
	String privilegeCode = "10370,10360,10350,10374,10378";    
    String contextPath = request.getContextPath(); 
%>

<% //--------------------------------------  include files list --%>

<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>
<html>
<head>
<title>MasterdataRelationship</title>
<PageFlow:CheckPageFlow pageName="p_masterdatarelationship"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/FuncLib.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>

<%@ include file="/inc/SummaryDivision.inc" %>

<% //--------------------------------------  output variant from pageflow --%>
<%
  	Vector totalsummary = (Vector)pageContext.getAttribute("totalsummary");
    Integer employeetype = (Integer)pageContext.getAttribute("employeetype");
	HashMap userinfo = (HashMap)session.getAttribute("userinfo");
	String gpcstr = (Integer)pageContext.getAttribute("globalpccode")+"";
	String datacategory =(Integer)pageContext.getAttribute("datacategory")+"";
  	if(totalsummary == null)
  	{
  		totalsummary = new Vector();
  	}
%>
    <script language="JavaScript" >
 	<%if("113".equals(gpcstr)){  datacategory="7";%>
 	  document.cform.datacategory.value=7;
    <%}%>
    <%if("114".equals(gpcstr)){  datacategory="8";%>
    document.cform.datacategory.value=8;
    <%}%>
    <%if("112".equals(gpcstr)){  datacategory="6";%>
    document.cform.datacategory.value=6;
    <%}%>
    <%if("116".equals(gpcstr)){  datacategory="13";%>
    document.cform.datacategory.value=13;
    <%}%>
    </script>
<script language="JavaScript" >
var popwindow;

function page_summary(actionvalue,orderbyname){
	 var editform = summaryPrepare(cform,actionvalue,orderbyname);
 	 editform.action = "MasterdataRelationship.jsp?<%= OvalTools.randomURL() %>";
 	 editform.target = "_self";
 	 isRunning = true;
 	 editform.submit();
}

function page_add(){
	 if(!checkForm(cform)) return;
	 
	 cform.actionname.value = "add";
  	 cform.target = "_self";
  	 isRunning = true;
  	 cform.submit();
}

function page_delete(){
    if(isNullChecked(cform.deleteids))
    {
        alert("<%= message.getMessageDesc("MUST_SELECT_ONE_RECORD_TO_DEL") %>");
        return;
    }
    if(!confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>")) return;
    
    cform.actionname.value = "delete";
    cform.target = "_self";
    isRunning = true;
	cform.submit();
}

function allcheckselect(){
	var allcheck = cform.allcheck.checked;
	var alldatafile = document.getElementsByName('deleteids');
	var length = alldatafile.length;
	if(allcheck){
		for(var i = 0 ; i < length;i++){
			alldatafile[i].checked = true;
		}
	}else{
		for(var i = 0 ; i < length;i++){
			alldatafile[i].checked = false;
		}	
	}
}
function setBusinessarea(id,areaname){
	var currentnum = document.cform.currentnum.value;
	document.cform['businessareaid'+currentnum].value=id;
	document.cform['areaname'+currentnum].value=areaname;
}

function popBusinessarea(num){
	if(popwindow!=null) popwindow.close();
 	if(num != null || num == ''){
		document.cform.currentnum.value=num;
 	}else{
 	 	document.cform.currentnum.value='';
 	}
 	
    url = 'BusinessAreaPop.jsp?<%= OvalTools.randomURL() %>';
    attribute = 'height=500, width=250,top=100,left=100,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no';

	popwindow = window.open(url,'newwindow', attribute);
}
function popOrgnization(){
	if(popwindow!=null) popwindow.close();
    var globalpccode = document.cform.globalpccode.value;
    url = 'OrgSummaryForPop.jsp?<%= OvalTools.randomURL() %>&globalpccode='+globalpccode;
    attribute = 'height=250, width=500,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no';

	popwindow = window.open(url,'newwindow', attribute);
}
var flag=0;
function popEmployee(num){

	if(popwindow!=null) popwindow.close();
	if(num != null || num == ''){
		document.cform.currentnum.value=num;
 	}else{
 	 	document.cform.currentnum.value='';
 	}

	var currentnum = document.cform.currentnum.value;
 	//var deptid = document.cform['deptid'+currentnum].value;
 	var productgroupid=document.cform['productgroupid'+currentnum].value;
 	
 	if(productgroupid == null || productgroupid == ''){
 	 alert("<%= message.getMessageDesc("Please_First_Choice_Product_Group") %>");
 	 return;
 	}
    url = '<%=contextPath %>/phap/masterdata/erm/BusinessUserWindow.jsp?<%= OvalTools.randomURL() %>&orgid=<%= userinfo.get("orgid")%>'+'&productgroupid='+productgroupid;
    attribute = 'height=300, width=500,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no';

	popwindow = window.open(url,'newwindow', attribute);
}
function set_repNameByPopWindow(id,code,name,parentid,parentname){
	//document.cform.employeecode.value=code;
	var currentnum = document.cform.currentnum.value;
	eval('document.cform.employeename'+currentnum).value=name;
	eval('document.cform.userid'+currentnum).value=id;
	//eval('document.cform.parentuserid'+currentnum).value=parentid;
	//eval('document.cform.parentemployeename'+currentnum).value=parentname;
}

function popBYEmployee(num){
	
  if(popwindow!=null) popwindow.close();
  if(num != null || num == ''){
	document.cform.currentnum.value=num;
	}else{
	 	document.cform.currentnum.value='';
	}

    var currentnum = document.cform.currentnum.value;
	var deptid = document.cform['deptid'+currentnum].value;
	
    url = 'BYContactSummaryForPop.jsp?<%= OvalTools.randomURL() %>&deptid='+deptid+'&orgid=<%= userinfo.get("orgid")%>'+'&employeetype=2';
    attribute = 'height=300, width=500,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no';

    popwindow = window.open(url,'newwindow', attribute);	

}
 

function popEmployee1(num){
	if(popwindow!=null) popwindow.close();
	if(num != null || num == ''){
		document.cform.currentnum.value=num;
 	}else{
 	 	document.cform.currentnum.value='';
 	}

	var currentnum = document.cform.currentnum.value;
 	//var deptid = document.cform['deptid'+currentnum].value;
    url = 'ContactSummaryForPop.jsp?<%= OvalTools.randomURL() %>&orgid=<%= userinfo.get("orgid")%>';
    attribute = 'height=300, width=500,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no';

	popwindow = window.open(url,'newwindow', attribute);
}
<%--
function popOrgGroup(num){
	if(popwindow!=null) popwindow.close();
	if(num != null || num == ''){
		document.cform.currentnum.value=num;
 	}else{
 	 	document.cform.currentnum.value='';
 	}
 	var currentnum = document.cform.currentnum.value;
 	var deptid = document.cform['deptid'+currentnum].value;
 	
    url = 'OrgGroupForPop.jsp?<%= OvalTools.randomURL() %>&deptid='+deptid;
    attribute = 'height=300, width=500,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no';

	popwindow = window.open(url,'newwindow', attribute);
}
function setOrgGroup(orggroupid,groupname){
	var num = document.cform.currentnum.value;
	document.cform['orggroupid'+num].value=orggroupid;
	document.cform['orggroupname'+num].value=groupname;
}
--%>
function setContact(contactid,username,contactname,parentid,parentname){
	var currentnum = document.cform.currentnum.value;
	if(flag==0){
		document.cform['userid'+currentnum].value=contactid;
		document.cform['employeename'+currentnum].value=contactname;
		document.cform['parentuserid'+currentnum].value=parentid;
		document.cform['parentemployeename'+currentnum].value=parentname;
	}else{
		document.cform['parentbyuserid'+currentnum].value=contactid;
		document.cform['parentbyemployeename'+currentnum].value=contactname;
	}
}

//byuser
function setBYContact(contactid,byusername,byemployeename,parentid,parentname){
	var currentnum = document.cform.currentnum.value;
	if(flag == 0){
		document.cform['byuserid'+currentnum].value=contactid;
		document.cform['byemployeename'+currentnum].value=byemployeename;
		//document.cform['parentuserid'+currentnum].value=parentid;
		//document.cform['parentemployeename'+currentnum].value=parentname;
	}else{
		
		document.cform['parentbyuserid'+currentnum].value=contactid;
		document.cform['parentbyemployeename'+currentnum].value=byemployeename;
	}
}

function setOrg(orgid,orgname){
	document.cform.orgid.value=orgid;
	document.cform.orgname.value=orgname;
}
function isModify(checkname,num){
	var checkvalue = document.cform[checkname+num].value;
	var oldvalue = document.cform['old'+checkname+num].value;
	if(Trim(checkvalue)==Trim(oldvalue)){
		return false;
	}else{
		return true;
	}
}

function popHistory(num){
	if(popwindow!=null) popwindow.close();
	var orgid = document.cform['orgid'+num].value;
	var deptid = document.cform['deptid'+num].value;
	var productgroupid = document.cform['productgroupid'+num].value
    url = 'MasterdataRelationshipLog.jsp?<%= OvalTools.randomURL() %>&deptid='+deptid+'&orgid='+orgid+'&productgroupid='+productgroupid;
    attribute = 'height=500, width=1000,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no';

	popwindow = window.open(url,'newwindow', attribute);
}

function checkModify(){
	var numrows = document.cform.numrows.value;
	for (i=0;i<numrows;i++){
		if(isModify('businessareaid',i)){
			document.cform['mdflag'+i].value=1;
			continue;
		}
		if(isModify('userid',i)){
			document.cform['mdflag'+i].value=1;
			continue;
		}
<%--		if(isModify('saleschannelid',i)){
			document.cform['mdflag'+i].value=1;
			continue;
		}
		if(isModify('orggroupid',i)){
			document.cform['mdflag'+i].value=1;
			continue;
		}
--%>		
        <%if("114".equals(gpcstr)){%>
		if(isModify('istarget',i)){
			document.cform['mdflag'+i].value=1;
			continue;
		}
		<%}%>
		/*if(isModify('hasprotocol',i)){
			document.cform['mdflag'+i].value=1;
			continue;
		}*/		
	}
}
function page_save(){
	checkModify();
	cform.actionname.value = "save";
    cform.target = "_self";
    isRunning = true;
	cform.submit();
}
function changeDept(){
	document.cform.areaname.value='';
	document.cform.businessareaid.value='';

	document.cform.employeename.value='';
		
	document.cform.userid.value='';
<%--	
	document.cform.orggroupname.value='';
	document.cform.orggroupid.value='';
--%>
}
var index = 0;
function mathindex(com){
    if(com.checked){
    	index++;
    }else{
    	index--;
    }
}

function page_clear(){
  document.cform.searchorgcode.value = "";
  document.cform.searchareaname.value = "";
  document.cform.searchdeptname.value = "";
  document.cform.searchorgname.value = "";
  document.cform.searchusername.value = "";
  document.cform.searchempname.value = "";
	
}

function set_orgNameByPopWindow(id,code,name){
    var currentnum = document.cform.currentnum.value;
	document.cform['productgroupname'+currentnum].value=name;
	document.cform['productgroupid'+currentnum].value=id;
}

function popPrdGroup(num){
	if(popwindow!=null) popwindow.close();
 	if(num != null || num == ''){
		document.cform.currentnum.value=num;
 	}else{
 	 	document.cform.currentnum.value='';
 	}
 	<%if("113".equals(gpcstr)){%>
 	  document.cform.datacategory.value=7;
    url = "<%=contextPath%>/masterdata/upm/ProductbrandPopWindow.jsp?<%= OvalTools.randomURL() %>&datacategory=7";
    <%}%>
    <%if("114".equals(gpcstr)){%>
    document.cform.datacategory.value=8;
    url = "<%=contextPath%>/masterdata/upm/ProductbrandPopWindow.jsp?<%= OvalTools.randomURL() %>&datacategory=8";
    <%}%>
    <%if("112".equals(gpcstr)){%>
    document.cform.datacategory.value=6;
    url = "<%=contextPath%>/masterdata/upm/ProductbrandPopWindow.jsp?<%= OvalTools.randomURL() %>&datacategory=6";
    <%}%>
    <%if("116".equals(gpcstr)){%>
    document.cform.datacategory.value=13;
    url = "<%=contextPath%>/masterdata/upm/ProductbrandPopWindow.jsp?<%= OvalTools.randomURL() %>&datacategory=13";
    <%}%>
    attribute = "height=400, width=600,top=120,left=120,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=yes";

	popwindow = window.open(url,"newwindow", attribute);
}


</script>

</head>
	
<body>
<form name="cform" method="post" action="<%=contextPath %>/Dispatcher"  target="_self">
	<input type="hidden" name="pagename" value="p_masterdatarelationship">
	<input type="hidden" name="actionname">
	<input type="hidden" name="currentnum"/>
	<input type="hidden" name="flags" value="0">
	<input type="hidden" name="numrows" value="<%=totalsummary.size() %>">
	<custom:hidden property="globalpccode" value="<%=gpcstr %>"/>
	<custom:hidden property="datacategory" value="<%=datacategory %>"/>
<% //--------------------------------------  page location --%>
	<%@ include file="/inc/PageLocation.inc" %>
	<table cellspacing="0" border="0" cellpadding="0">
	   	<tr>
	     	<td>
			<%= label.getLabelName("L_OverBidSearch") + label.getLabelName("L_Colon")%><br>
			<table cellspacing="0" border="0" cellpadding="0" onkeydown="if(event.keyCode==13) page_summary('search');">
				<tr>
					<td width="250"><%= label.getLabelName("L_PartCodeC") + label.getLabelName("L_Colon")%><custom:text property="searchorgcode"/></td>
					<td width="250"><%= label.getLabelName("L_BusinessAreaName") + label.getLabelName("L_Colon")%><custom:text property="searchareaname"/></td>
					<td width="210"><%= label.getLabelName("L_DeptName2") + label.getLabelName("L_Colon")%><custom:text property="searchdeptname"/><br></td>
				</tr>
				<tr>
					<td><%= label.getLabelName("L_PartNameN") + label.getLabelName("L_Colon")%><custom:text property="searchorgname"/></td>
					<td><%= label.getLabelName("L_username") + label.getLabelName("L_Colon")%><custom:text  property="searchusername"/></td>
					<td><%= label.getLabelName("L_EmployeeName") + label.getLabelName("L_Colon")%><custom:text property="searchempname"/></td>
					<td width="150"><a href="javascript:page_summary('search')"><img src="<%=contextPath%>/images/<%= strLanguageCode %>/go.gif" border="0" ></a>
					&nbsp;&nbsp;
					<button type="button" onclick="page_clear()" class="button1" name="re" value="clear" style="width:60"><%=label.getLabelName("L_Clear") %></button>
				</tr>
			</table>	
	     	</td>
	    </tr>
	    <tr> 
		    <td> 
		      <table border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
	    	  <div style="overflow:auto;width:1700px">
		        <tr class="deepblue-left">
				  <td width="1%" class="title_center"><input type="checkbox" name="allcheck" class="normalradio" onclick="allcheckselect();"></td>
		          <td class="title_center" width="18%"><a href="javascript:page_summary('orderby','orgcode')"><%= label.getLabelName("L_Partner") %></a>&nbsp;<span class='red'>*</span></td>
		          <td class="title_center" width="9%" ><a href="javascript:page_summary('orderby','deptname')"><%= label.getLabelName("L_Dept") %></a>&nbsp;</td>
		          <td class="title_center" width="9%" ><a href="javascript:page_summary('orderby','productgroupname')"><%= label.getLabelName("L_ProductGroup") %></a>&nbsp;<span class='red'>*</span></td>
		          <td class="title_center" width="10%"><a href="javascript:page_summary('orderby','areaname')"><%= label.getLabelName("L_BusinessAreaName") %></a></td>
		          <td class="title_center" width="10%"><a href="javascript:page_summary('orderby','employeename')"><%= label.getLabelName("L_Employee") %></a></td>
		          <td class="title_center" width="10%"><a href="javascript:page_summary('orderby','parentemployeename')"><%= label.getLabelName("L_employeenameUp") %></a></td>
		          <!--  
		          <td class="title_center" width="10%"><a href="javascript:page_summary('orderby','byemployeename')"><%= label.getLabelName("L_BYEmpleoyee") %></a></td>
		          <td class="title_center" width="10%"><a href="javascript:page_summary('orderby','parentbyemployeename')"><%= label.getLabelName("L_BYEmployeeUP") %></a></td>
				  -->
				<%if("114".equals(gpcstr)){%>
 		          <td class="title_center" width="4%"><a href="javascript:page_summary('orderby','istarget')"><%= label.getLabelName("L_YorN") + label.getLabelName("L_Target") %></a></td>
				<%}%>
		          <td class="title_center" width="4%"><a href="javascript:page_summary('orderby','isbale')"><%= label.getLabelName("L_YesOrNoBale")  %></a></td>
		          <!--<td class="title_center" width="4%"><a href="javascript:page_summary('orderby','hasprotocol')"><%= label.getLabelName("L_IsProtocol") %></a></td>-->
		          <td class="title_center" width="2%">&nbsp;</td>
		        </tr>
		        <%
	            	int i = 0;
	             	String strClassType = new String();
	          	%>
		         <logic:iterate id="onerow" collection="<%= totalsummary %>" indexId="idx">
		           	<%
		            	HashMap tempMap = (HashMap)pageContext.getAttribute("onerow");
		            	if(i%2 == 1)
		            	{
		              		strClassType = "td-listrom";
		            	}else{
		              		strClassType = "";
		            	}
		            	i++;
		            	
		          	%>
		          	<tr id="tr<%=idx %>" class="none">
		          		<td id="td" class="title_center" >
		              		<input type="checkbox" name="deleteids" value="<%=JspHelper.filterNull( tempMap.get("masterdatarelationshipid") )%>" class="checkbox">
		            		<custom:hidden property="mdflag" colIndex="<%=idx %>" value="0"/>
		            		<custom:hidden name="onerow" property="masterdatarelationshipid" colIndex="<%=idx %>"/>
		            	</td>
		            	<td class="title_left">
						    &nbsp;&nbsp;
							<custom:write name="onerow" property="orgcode" nbsp="true"/>
							&nbsp;
		            		<custom:write name="onerow" property="orgname" nbsp="true"/>
		            		<custom:hidden name="onerow" property="orgid" colIndex="<%=idx %>"/>
		            	</td>
		            	<td class="title_center">
		            	    &nbsp;
		            	    <custom:write name="onerow" property="deptname" nbsp="true"/>
		            	    <custom:hidden name="onerow" property="deptid" colIndex="<%=idx %>"/>
		            	    <custom:hidden name="onerow" property="deptid" changedName="olddeptid" colIndex="<%=idx %>"/>
		            	</td>
		            	<td class="title_center">
		            	    <custom:text name="onerow" property="productgroupname" readonly="true" colIndex="<%=idx %>"/>
		            	    <a onclick="popPrdGroup(<%= idx%>)"><custom:button type="3" value="*"/></a>
		            	    <custom:hidden name="onerow" property="productgroupid" colIndex="<%=idx %>"/>
						    <!--<custom:select optionInnerTextKey="productgroupname" optionsName="allpgroups" onchange="changeDept()" property="productgroupid" name="onerow" optionValueKey="productgroupid" colIndex="<%=idx %>"/>-->
						    <custom:hidden name="onerow" property="productgroupid" changedName="oldproductgroupid" colIndex="<%=idx %>"/>
		            	</td>		            	
						<td class="title_center">
							<custom:hidden name="onerow" property="businessareaid" changedName="oldbusinessareaid" colIndex="<%=idx %>"/>
							<custom:hidden name="onerow" property="businessareaid" colIndex="<%=idx %>"/>
				           	<custom:text name="onerow" property="areaname" readonly="true" colIndex="<%=idx %>"/>
				           	<a onclick="popBusinessarea(<%= idx%>)"><custom:button type="3" value="*"/></a>
				           	&nbsp;
						</td> 
						<td class="td_right">
							<custom:hidden name="onerow" property="userid" changedName="olduserid" colIndex="<%=idx %>"/>
							<custom:hidden name="onerow" property="userid" colIndex="<%=idx %>"/>
                            <custom:write name="onerow" property="username" nbsp="true"/>
							&nbsp;
							<custom:text name="onerow" property="employeename" size="10"  readonly="true" colIndex="<%=idx %>"/>
							<a onclick="flag=0;popEmployee(<%= idx%>);"><custom:button type="3" value="*"/></a>
						</td>
						<td class="title_center">
							<custom:hidden name="onerow" property="parentuserid" changedName="oldparentuserid" colIndex="<%=idx %>"/>
							<custom:hidden name="onerow" property="parentuserid" colIndex="<%=idx %>"/>
                            <custom:write name="onerow" property="parentemployeecode" nbsp="true"/>
							&nbsp;
							<custom:text name="onerow" property="parentemployeename" size="10"  readonly="true" style="border:0" colIndex="<%=idx %>"/>
							<!--<a onclick="flag=1;popEmployee1(<%= idx%>);"><custom:button type="3" value="*"/></a>-->
						</td>
						
						<!-- byuserid -->
						<!--  
						<td class="td_right">
							<custom:hidden name="onerow" property="byuserid" changedName="oldbyuserid" colIndex="<%=idx %>"/>
							<custom:hidden name="onerow" property="byuserid" colIndex="<%=idx %>"/>
                            <custom:write name="onerow" property="byusername" nbsp="true"/>
							&nbsp;
							<custom:text name="onerow" property="byemployeename"  size="10" readonly="true" colIndex="<%=idx %>"/>
							<a onclick="flag=0;popBYEmployee(<%= idx%>);"><custom:button type="3" value="*"/></a>
						</td>
						-->
						<!-- parent -->
						<!--
						<td class="td_right">
							<custom:hidden name="onerow" property="parentbyuserid" changedName="oldparentbyuserid" colIndex="<%=idx %>"/>
							<custom:hidden name="onerow" property="parentbyuserid" colIndex="<%=idx %>"/>
                            <custom:write name="onerow" property="parentbyusername" nbsp="true"/>
							&nbsp;
							<custom:text name="onerow" property="parentbyemployeename"  size="10" readonly="true" colIndex="<%=idx %>"/>
							<a onclick="flag=1;popEmployee(<%= idx%>);"><custom:button type="3" value="*"/></a>
						</td>
						-->
<%--					<td class="title_center">
							<custom:hidden name="onerow" property="saleschannelid" changedName="oldsaleschannelid" colIndex="<%=idx %>"/>
							<custom:select name="onerow" property="saleschannelid" colIndex="<%=idx %>" optionsName="allsaleschannels" optionInnerTextKey="saleschannelname" optionValueKey="saleschannelid" defaultValue="-------" defaultValueCost=" " style="width:100px;"/>
						</td> 
						<td class="title_center">
							<custom:hidden name="onerow" property="orggroupid" changedName="oldorggroupid" colIndex="<%=idx %>"/>
		            		<!--  custom:select  name="onerow" property="orggroupid" colIndex="<%=idx %>" optionsName="allorggroups" optionInnerTextKey="groupname" optionValueKey="orggroupid" defaultValue="-------" defaultValueCost=" " style="width:100px;"/-->
		            		<custom:hidden name="onerow" property="orggroupid" colIndex="<%=idx %>"/>
							<custom:text name="onerow" property="groupname" readonly="true" colIndex="<%=idx %>"/>
							<a onclick="popOrgGroup(<%= idx%>)"><custom:button type="3" value="*"/></a>
		            	</td>
--%>		        <%if("114".equals(gpcstr)){%>	
						<td class="title_center">
							<custom:hidden name="onerow" property="istarget" changedName="oldistarget" colIndex="<%=idx %>"/>
						    <custom:selectdic name="onerow" property="istarget" colIndex="<%=idx %>" dictType="YesOrNo" defaultValue="---" defaultValueCost=" "/>
		     		    </td>
					<%}%>
		     		    <td class="title_center">
							<custom:hidden name="onerow" property="isbale" changedName="oldisbale" colIndex="<%=idx %>"/>
						    <custom:selectdic name="onerow" property="isbale" colIndex="<%=idx %>" dictType="YesOrNo" defaultValue="---" defaultValueCost=" "/>
		     		    </td>
		     		    
		     		    <!--<td class="title_center">
		     		    	<custom:hidden name="onerow" property="hasprotocol" changedName="oldhasprotocol" colIndex="<%=idx %>"/>
		     		    	<custom:selectdic name="onerow" property="hasprotocol" colIndex="<%=idx %>" dictType="YesOrNo" defaultValue="---" defaultValueCost=" "/>
		     		    </td>-->
		     		    <td>
		     		    	<a onclick="popHistory(<%= idx%>)"><custom:button type="3" label="L_History"/></a>
		     		    </td>
		     		 </tr>
		     	 </logic:iterate>
		     	 <tr class="none">
		           <td>&nbsp;</td>
		           <td class="title_center">
		           	<custom:text property="orgname" readonly="true"></custom:text>
		           	<custom:hidden property="orgid" command="notnull" label="L_Partner"/>
		           	<a onclick="popOrgnization()"><custom:button type="3" label="" value="*"/></a>
		           </td>
		           <td class="title_center">
		            <custom:write property="deptname" nbsp="true"/>
				   </td>
		           <td class="title_center">
				    <custom:hidden property="productgroupid" command="notnull" label="L_ProductGroup"/>
					<custom:text property="productgroupname" readonly="true"/>
					<a onclick="popPrdGroup()"><custom:button type="3" value="*"/></a>
				   </td>				   
		           <td class="title_center"><custom:text property="areaname" readonly="true"/><custom:hidden property="businessareaid" />&nbsp;<a onclick="popBusinessarea()"><custom:button type="3" value="*"/></a>&nbsp;</td>
		           <td class="td_right"><custom:text property="employeename" size="10" readonly="true"/><custom:hidden property="userid" />&nbsp;<a onclick="flag=0;popEmployee()"><custom:button type="3" value="*"/></a>
		           </td>
				   <td class="title_center">
		           	<custom:text property="parentemployeename" size="10"  style="border:0" readonly="true"/>
		           	<custom:hidden property="parentuserid"/><!--<a onclick="flag=1;popEmployee1();"><custom:button type="3" value="*"/></a>-->
		           </td>
		           <!--  
		            <td class="td_right">
		           	<custom:text property="byemployeename" size="10" readonly="true"/>
		           	<custom:hidden property="byuserid" /><a onclick="flag=0;popBYEmployee()"><custom:button type="3" value="*"/></a>
		           </td>
		           
		              <td class="td_right">
		           	<custom:text property="parentbyemployeename" size="10" readonly="true"/>
		           	<custom:hidden property="parentbyuserid" /><a onclick="flag=1;popEmployee()"><custom:button type="3" value="*"/></a>
		           </td>-->
		           
<%--		           <td class="title_center">
		           	<custom:select property="saleschannelid" optionsName="allsaleschannels" optionInnerTextKey="saleschannelname" optionValueKey="saleschannelid" defaultValue="-------" defaultValueCost=" " style="width:100px;"/>
		           </td>
		           <td class="title_center">
		           	<!-- custom:select property="orggroupid" optionsName="allorggroups" optionInnerTextKey="groupname" optionValueKey="orggroupid" defaultValue="-------" defaultValueCost=" " style="width:100px;"/-->
		           	<custom:hidden property="orggroupid"/>
					<custom:text property="groupname" readonly="true"/>
					<a onclick="popOrgGroup()"><custom:button type="3" value="*"/></a>
		           </td>
--%>		    <%if("114".equals(gpcstr)){%>       
		           <td class="title_center">
		           	<custom:selectdic property="istarget" dictType="YesOrNo" defaultValue="---" defaultValueCost=" "/>
		           </td>
				<%}%>
		           <td class="title_center">
		           	<custom:selectdic property="isbale" dictType="YesOrNo" defaultValue="---" defaultValueCost=" "/>
		           </td>
		           <!--<td class="title_center">
		           	<custom:selectdic property="hasprotocol" dictType="YesOrNo" defaultValueCost=" " defaultValue="---" />
		           </td>-->
		           <td>
		           		&nbsp;
		           </td>
			     </tr>
			  </div>	
		      <%@ include file="/inc/SummaryAction.inc" %>
		      </table>	      
		      <table width="100%" cellspacing="0" cellpadding="0">
		        <tr> 
		          <td class="summary_top"></td>
		        </tr>
		        <tr>
				     <td class="title_center">
						<a onclick="page_add()"><custom:button type="1" label="L_Add" imgsrc="add.gif" border="0" style="width:60"/></a>
						<%if(totalsummary.size() >0 ){%>
						<a onclick="page_save()"><custom:button type="1" label="L_Save" imgsrc="delete.gif" border="0" style="width:60"/></a>
						<a onclick="page_delete()"><custom:button type="1" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60"/></a>
						<%} %>
					 </td>
				</tr>
		      </table>
		    </td>
	  </tr>
	
	</table>
</form>
</body>
</html>